home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / comms / other / iris / install-buttons < prev    next >
Text File  |  1999-05-14  |  3KB  |  106 lines

  1. /* REXX script to install Iris buttons            */
  2. /* Creates hard link to selected button directory */
  3. /* Jilles Tjoelker, 14-Mar-1998                   */
  4.  
  5. options failat 20
  6. options results
  7.  
  8. currentdir='' /* change here, for example 'AmiTCP:Iris/' */
  9. if ~exists(currentdir||'Storage') then do
  10.   address command 'requestfile >t:f "" title "Select Iris drawer" drawersonly'
  11.   if rc>0 then do
  12.     address command 'delete >nil: t:f'
  13.   end
  14.   else nop
  15.   open(1,'t:f','read')
  16.   currentdir=readln(1)
  17.   close(1)
  18.   currentdir=strip(currentdir,'b','"')
  19.   address command 'delete >nil: t:f'
  20. end
  21. else nop
  22. pragma('d',currentdir)
  23. if ~exists('Storage') then do
  24.   address command 'requestchoice >nil: "Install-Buttons" "The *"Storage*" directory doesn''t exist:*Nwrong selection or wrong installation." "Abort"'
  25.   exit
  26. end
  27.  
  28. parse arg buttons
  29.  
  30. if buttons="" then do
  31.   buttons="Storage/"
  32.   address command 'requestfile >t:f "Storage/" title "Select button set" drawersonly'
  33.   if rc>0 then do
  34.     address command 'delete >nil: t:f'
  35.     exit
  36.   end
  37.   else nop
  38. end
  39. else nop
  40. open(1,'t:f','read')
  41. buttons=readln(1)
  42. close(1)
  43. address command 'delete >nil: t:f'
  44. if substr(buttons,length(buttons)-1,1)=':' then do
  45.   address command 'requestchoice >nil: "Install-Buttons" "You can''t select the root directory." "Abort"'
  46.   exit
  47. end
  48. address command 'delete >nil: Buttons'||'0a'x||'setenv tmpioerr $result2'
  49. res1=rc
  50. open(1,'env:tmpioerr','read')
  51. ioerr=readln(1)
  52. close(1)
  53. address command 'delete >nil: env:tempioerr'
  54. if res1>0 then do
  55.   select
  56.   when ioerr=205 then nop
  57.   when ioerr=216 then
  58.     do
  59.       address command 'rename Buttons Storage/Old_Buttons'
  60.       address command 'rename Buttons.info Storage/Old_Buttons.info'
  61.       if rc>0 then do
  62.         address command 'requestchoice >nil: "Install-Buttons" "The directory *"Storage*" does not exist.*NThis is caused by a wrong installation." "Abort"'
  63.         exit
  64.       end
  65.       else nop
  66.     end
  67.   otherwise
  68.     address command 'requestchoice >nil: "Install-Buttons" "AmigaDOS error' ioerr '*N(`fault' ioerr '`)" "Abort"'
  69.     exit
  70.   end
  71. end
  72. else address command 'delete >nil: Buttons.info'
  73. options failat 1
  74. address command 'makelink hard force Buttons '||buttons
  75. buttons=substr(buttons,1,length(buttons)-2)||'.info"'
  76. address command 'makelink hard force Buttons.info '||buttons
  77. options failat 20
  78. if show('p','IRIS') then do
  79.   address 'IRIS'
  80.   'ASKCHOICE "Install-Buttons" "The buttons have been installed.*NIt is necessary to restart Iris*Nto use the new buttons.*NDo you wish me to do this?" *_Yes|_No'
  81.   if rc=0 then do
  82.     'GETFOLDER'
  83.     curfol=result
  84.     q=0
  85.     do while rc=0
  86.       'FOLDERNAME' q
  87.       if result=curfol then leave
  88.       q=q+1
  89.     end
  90.     xrc=rc
  91.     'QUIT'
  92.     do while show('p','IRIS')
  93.       address command 'wait 1'
  94.     end
  95.     if xrc=0 then do 
  96.       address command 'run >nil: <nil: iris curfol' q
  97.     end
  98.     else do
  99.       address command 'run >nil: <nil: iris'
  100.     end
  101.   end
  102.   else nop
  103. end
  104. else,
  105.   address command 'requestchoice >nil: "Install-Buttons" "The buttons have been installed." "OK"'
  106.